

package com.scs.application.modules.base.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.scs.application.core.model.DataEntity;
import com.scs.application.core.utils.excel.annotation.ExcelAutoColumnSize;
import com.scs.application.core.utils.excel.annotation.ExcelComment;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 供应商实体对象
 */
@ExcelAutoColumnSize
@TableName("supplier")
@Data
@EqualsAndHashCode(callSuper = false)
@ToString(callSuper = true)
@Accessors(chain = true)
public class ExcelSupplierDTO extends DataEntity implements IExcelDataModel, IExcelModel, Serializable {


    /**
     * 机构ID
     */
    //@NotBlank(message="组织机构不能为空")
    private String officeId;

    /**
     * 识别码
     */
    @ExcelComment(value = "如果不填写系统将自动生成", example = "sp001")
    @Excel(name = "识别码", orderNum = "10")
//    @NotBlank(message = "识别码不能为空")
//    @Length(min = 1, max = 7, message = "识别码长度必须介于 1 和 7 之间")
    private String code;

    /**
     * 统一社会信用代码
     */
    @ExcelComment(value = "如果不填写系统将自动生成", example = "sp001")
    @Excel(name = "统一社会信用代码", orderNum = "20")
//    @NotBlank(message = "统一社会信用代码不能为空")
//    @Length(min = 1, max = 30, message = "统一社会信用代码长度必须介于 1 和 30 之间")
    private String companyCode;

    /**
     * 供应商名称
     */
    @ExcelComment(notNull = true, example = "供应商测试")
    @Excel(name = "供应商名称", orderNum = "30", isImportField = "true")
    @NotBlank(message = "供应商名称不能为空")
    @Length(min = 1, max = 100, message = "供应商名称长度必须介于 1 和 100 之间")
    private String name;

    /**
     * 助记码
     */
    //@Excel(name = "助记码", orderNum = "40")
    @Length(max = 50, message = "助记码长度必须介于 0 和 50 之间")
    private String pinyin;

    /**
     * 登陆账号
     */
    @ExcelComment(value = "不填写登录账号则系统自动生成", example = "sp001")
    @Excel(name = "登录账号", orderNum = "45")
//    @NotBlank(message = "登录账号不能为空")
//    @Length(max = 30, message = "登录账号长度必须介于 0 和 30 之间")
    private String loginKey;

    /**
     * 是否药品供应商
     */
    @ExcelComment(notNull = true, dict = "common_yes_no", example = "1")
    @Excel(name = "药品供应商", orderNum = "50", dict = "common_yes_no", isImportField = "true")
    @NotNull(message = "是否药品供应商不能为空")
    private String isDrug;

    /**
     * 是否耗材供应商
     */
    @ExcelComment(notNull = true, dict = "common_yes_no", example = "1")
    @Excel(name = "耗材供应商", orderNum = "60", dict = "common_yes_no", isImportField = "true")
    @NotNull(message = "是否耗材供应商不能为空")
    private String isConsumable;

    /**
     * 是否试剂供应商
     */
    @ExcelComment(notNull = true, dict = "common_yes_no", example = "0")
    @Excel(name = "试剂供应商", orderNum = "70", dict = "common_yes_no", isImportField = "true")
    @NotNull(message = "是否试剂供应商不能为空")
    private String isReagent;

    /**
     * 区域id
     */
    // @Excel(name = "区域id", orderNum = "80")
    private Long regionId;

    /**
     * 区域名称
     */
    @ExcelComment(value = "选填", example = "长沙")
    @Excel(name = "区域名称", orderNum = "80")
    private String regionName;

    /**
     * 地址
     */
    @ExcelComment(notNull = true, value = "如果没有就填写：default", example = "长沙xxx")
    @Excel(name = "注册地址", orderNum = "90", isImportField = "true")
    @NotBlank(message = "注册地址不能为空")
    @Length(min = 1, max = 200, message = "地址长度必须介于 1 和 200 之间")
    private String address;

    /**
     * 联系人
     */
    @ExcelComment(notNull = true, value = "如果没有就填写：default", example = "王老师")
    @Excel(name = "联系人", orderNum = "100")
    @NotBlank(message = "联系人不能为空")
    @Length(min = 1, max = 50, message = "联系人长度必须介于 1 和 50 之间")
    private String contactor;

    /**
     * 邮箱
     */
    @ExcelComment(value = "选填", example = "11@11.com")
    @Excel(name = "邮箱", orderNum = "110")
//    @NotBlank(message = "邮箱不能为空")
    @Length(min = 0, max = 50, message = "邮箱长度必须介于 0 和 50 之间")
    private String email;

    /**
     * 电话
     */
    @ExcelComment(value = "选填", example = "021-111111")
    @Excel(name = "固定电话", orderNum = "120")
    @Length(max = 20, message = "固定电话长度必须介于 0 和 20 之间")
    private String phone;

    /**
     * 移动电话
     */
    @ExcelComment(value = "选填", example = "17600000000")
    @Excel(name = "移动电话", orderNum = "130")
    @Length(max = 20, message = "移动电话长度必须介于 0 和 20 之间")
    private String mobile;

    private Integer rowNum;
    private String errorMsg;

    @Override
    public Integer getRowNum() {
        return rowNum;
    }

    @Override
    public void setRowNum(Integer rowNum) {
        this.rowNum = rowNum;
    }

    @Override
    public String getErrorMsg() {
        return errorMsg;
    }

    @Override
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }
}
